#页面类：登录页
from selenium.webdriver.common.by import By

#导入基类
from utils.page_base import PageBase

class PageLogin(PageBase):
    path_url="/simple/login"
    loc_zanhao=By.NAME,"login_info"
    loc_pwd=By.NAME,"password"
    loc_loginButton=By.XPATH,"//input[@type='submit' and @value='登录']"
    loc_div=By.CSS_SELECTOR,"div.prompt"

    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)

    #打开本网页
    def openUrl(self):
        self.open(PageLogin.path_url)

    #输入账号
    def input_zanhao(self,data):
        self.input(PageLogin.loc_zanhao,data)

    #输入密码
    def input_pwd(self,data):
        self.input(PageLogin.loc_pwd,data)

    #点击登录按钮
    def click_loginButton(self):
        self.click(PageLogin.loc_loginButton)

    #获取div标签的文本内容
    def getDivText(self):
        return self.getEleTextOrAttr(PageLogin.loc_div)

    #获取账号输入框的class属性的值
    def ZanhaoAttrClass(self):#"input_text     invalid-text"
        return self.getEleTextOrAttr(PageLogin.loc_zanhao,"class")

    # 获取密码输入框的class属性的值
    def pwdAttrClass(self):  # "input_text     invalid-text"
        return self.getEleTextOrAttr(PageLogin.loc_pwd, "class")







